package com.world.lzh.service;

import com.world.lzh.dao.UserDao;
import com.world.lzh.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author lzh
 * @Date 2022/5/14 - 10:49
 * @Description
 * @Version 1.0.0
 **/
@Service
public class UserService {

    @Autowired
    private UserDao userDao;

    public List<User> selectUser(User user) {
        List<User> userList = userDao.selectUser(user);
        return userList;
    }

    public String insertUser(User user) {
        int result = userDao.insertUser(user);
        return result > 0 ? "添加成功" : "添加失败";
    }

    public String updateUser(User user) {
        int result = userDao.updateUser(user);
        return result > 0 ? "修改成功" : "修改失败";
    }
}
